package org.ricks.jdk25;

import org.openjdk.jol.info.ClassLayout;
import org.ricks.jdk25.vo.Player;

/**
 * org.ricks.jdk25.vo.Player object internals:
 * OFF  SZ               TYPE DESCRIPTION               VALUE
 *   0   8                    (object header: mark)     0x0000000000000001 (non-biasable; age: 0)
 *   8   4                    (object header: class)    0x01042a10
 *  12   4                int Player.age                1
 *  16   4   java.lang.String Player.id                 (object)
 *  20   4                    (object alignment gap)
 * Instance size: 24 bytes
 * Space losses: 0 bytes internal + 4 bytes external = 4 bytes total
 *
 *
 * -XX:+UseCompactObjectHeaders
 *  org.ricks.jdk25.vo.Player object internals:
 * OFF  SZ               TYPE DESCRIPTION               VALUE
 *   0   8                    (object header: mark)     0x0104300000000001 (Lilliput)
 *   8   4                int Player.age                1
 *  12   4   java.lang.String Player.id                 (object)
 * Instance size: 16 bytes
 * Space losses: 0 bytes internal + 0 bytes external = 0 bytes total
 *
 */
public class ObjectMem {


    static void main() {
        String s = "Hello";
        Player player = new Player("ricks",1);
        System.out.println(ClassLayout.parseInstance(player).toPrintable());
    }
}
